import { forwardRef, useState, useImperativeHandle } from 'react';

type Props = {
   value: string;
};
export default forwardRef((props: Props, ref) => {
   const [value, setValue] = useState(props.value);
   const handleChange = (e) => {
      setValue(e.target.value);
   };

   useImperativeHandle(ref, () => ({
      value,
   }));

   return (
      <div className="w-full flex-base">
         <span className="text-sm">备注</span>
         <span>
            <input
               placeholder="请输入备注..."
               className="text-right"
               value={value}
               onChange={handleChange}
            />
         </span>
      </div>
   );
});
